<template>
  <div class="goods-item">
    <RouterLink to="/">
      <!-- 单个产品的盒子 -->
      <img :src="goods.picture">
      <p class="name ellipsis-2">{{goods.name}}</p>
      <p class="desc">{{goods.desc}}</p>
      <p class="price">&yen;{{goods.price}}</p>
      <!-- 找相似的弹窗 -->
      <div class="extra">
        <RouterLink to="/">
          <span>找相似</span>
          <span>发现更多宝贝 &gt;</span>
        </RouterLink>
      </div>
    </RouterLink>
  </div>
</template>

<script>
export default {
  name: 'HomeGoods',
  props: {
    goods: {
      type: Object,
      default: () => { }
    }
  },
  setup() {
  }
}
</script>

<style lang="less" scoped>
.goods-item {
  width: 240px;
  height: 300px;
  padding: 10px 30px;
  position: relative;
  overflow: hidden;
  border: 1px solid transparent; // transparent 透明
  transition: all 0.5s;
  .img {
    display: block;
    width: 160px;
    height: 160px;
  }
  p {
    margin-top: 6px;
    font-size: 16px;
    &.name {
      height: 44px;
    }
    &.desc {
      color: #666;
      height: 22px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    &.price {
      margin-top: 10px;
      font-size: 20px;
      color: @priceColor;
    }
  }
  &:hover {
    border-color: @xtxColor;
    .extra {
      transform: none;
    }
  }
}

.extra {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 86px;
  width: 100%;
  background: @xtxColor;
  text-align: center;
  transform: translateY(100%);
  transition: all 0.5s;
  span {
    display: block;
    color: #fff;
    width: 120px;
    margin: 0 auto;
    line-height: 30px;
    &:first-child {
      font-size: 18px;
      border-bottom: 1px solid #fff;
      line-height: 40px;
      margin-top: 5px;
    }
  }
}
</style>